class RestfullService(object):
	''' This class is a service stub
	ex:
	delicious = RestfullService('http://del.icio.us/api/{{resources}}', format='json') 
	
	# To add a tag, POST
	delicious.api.radian.tags += delicious.resources.tag(id=123, text='my Website', url='http://abdulradi.com')
	#OR:
	delicious.api.radian.tags += {'id'=123, 'text:'my Website', 'url':'http://abdulradi.com'}

	# To delete a tag, DELETE on Collection url
	del delicious.api.radian.tags # no params
	#OR, with params
	delicious.api.radian.tags -= delicious.resources.tag(id=123) # just a dict {'id'=123}
	#OR:
	delicious.api.radian.tags -= {'id'=123}
	#OR:
	del delicious.api.radian.tags(id=123)
	
	# To Delete an item from collection, by it's URL
	del delicious.api.radian.tags.123 

	# GET:
	print delicious.api.radian.tags.123 
	for tag in delicious.api.radian.tags(count=10):
		print tag

	'''
	def __init__(self, setting_str, format='json'):
		self.resource_url = None
		self.format = format
		self.api = Resource(self, '/')
		self.resources = ResourcesFactory()

class Resource(object):
	''' Simulates a resource on the Server
	'''
	def __init__(self, service, url):
		self.service = service
		self.url = url
		self.params = {}

	def __call__(self, **params):
		print 'call: ' + str(params)
		self.params = params
		return self

	def __iadd__(self, params): #POST
		# POST: api/resource ? **params
		print 'iadd: ' + str(params)
		return self

	def __isub__(self, params): #DELETE (from collection)
		# DELETE: api/resource ? **params
		print 'isub: ' + str(params)
		return self

	def __del__(self):
		print 'del'

	def __delattr__(self, name):
		print 'del self.' + name
		pass

	def __get__(self, instance, owner):
		print 'instance: ' + instance
		print 'owner: ' + owner

	def __set__(self, instance, value):
		print 'instance: ' + instance
		print 'value: ' + value

	def __delete__(self, instance):
		print 'instance: ' + instance

class ResourcesFactory(object):
	''' Simple class that returns a dict to hold some params
	'''
	def __get__(self):
		return {}

	